#!/usr/bin/env bash

set -e

SCRIPT_DIR="$(dirname "$0")"
cd "$SCRIPT_DIR/.."

bin/check-nofile

if [ `uname -s` == "Darwin" ]; then
    RANDOMX_JIT="disable randomx_jit"
else
    RANDOMX_JIT=
fi

echo "Moving the benchmark folder to benchmark.old..."
rm -rf benchmark.old
if [ -d benchmark ]; then
    mv -i benchmark benchmark.old;
fi

"bin/arweave" foreground -run ar main $RANDOMX_JIT init mine data_dir benchmark
